//寻找掩体进驻
params ["_group", "_target"];

//
{
	if(vehicle _x == _x)then{
		
		_CoverPos = [_x, _target] call fn_findCoverPos;
		
		if !(isNil "_CoverPos") then
		{
			//Lets us know where they were told to move!
			if (Param_Debug == 1) then
			{
				_arrow = "Sign_Sphere200cm_F" createVehicle [0,0,0];
				_arrow setpos _CoverPos;
				/*_arrow spawn 
				{
					_Counter = 0;
					_Position = getpos _this;
					_NewPos2 = _Position select 2;						
					while {_Counter < 60} do
					{
						_NewPos2 = _NewPos2 + 0.1;
						_this setpos [_Position select 0,_Position select 1,_NewPos2];
						_Counter = _Counter + 1;
						sleep 0.5;
					};
					deletevehicle _this;
				};
				*/
			};
		
		/*
			_WaitTime = diag_ticktime + 35;
			_x doWatch ObjNull;
			_x disableAI "TARGET";
			_x disableAI "AUTOTARGET";																									
			_x disableAI "SUPPRESSION";				
			_x disableAI "AUTOCOMBAT";				
			While {alive _x && diag_ticktime < _WaitTime && (_x distance _CoverPos) > 3} do 
			{
				_x forcespeed -1;
				_x domove _CoverPos;
				sleep 4;		
			};
			_x forcespeed 0;
			_x doWatch _target;
			_x enableAI "AUTOTARGET";
			_x enableAI "TARGET";		
			_x enableAI "SUPPRESSION";				
			_x enableAI "AUTOCOMBAT";	
*/
			_x doMove _CoverPos;
			[_x]spawn{
				waitUntil{sleep 1;unitReady _this};
				doStop _this;
			};			
		};
	};
}forEach (units _group);